﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace fsw_backup
{
    static class BackupHelper
    {
        public static void BackupFile(string FullName, string BackupPath)
        {
            if (FullName == null) throw new NullReferenceException("FullName is null");
            if (BackupPath == null) throw new NullReferenceException("BackupPath is null");

            string FileName = Path.GetFileName(FullName);
            string NewFileName = string.Format(@"{0}.{1:yyyy-MM-dd_HH\hmm\msss}{2}", Path.GetFileNameWithoutExtension(FileName), DateTime.Now, Path.GetExtension(FileName));
            string NewFullName = Path.Combine(BackupPath, NewFileName);

            File.Copy(FullName, NewFullName);
        }
    }
}
